package com.xiaotu.threadMethod;

/**
 * @Author xiaotu
 * @Description //TODO
 * @Date 2022/3/25 16:25
 * @ClassName TestJoin
 * @Version 1.0
 **/
public class TestJoin implements Runnable{
    @Override
    public void run() {
        for (int i = 0; i < 365; i++) {
            System.out.println("VIP,JOIN on this thread"+i);
        }
    }

    public static void main(String[] args) {
        TestJoin testJoin = new TestJoin();
        Thread thread = new Thread(testJoin);
        thread.start();
        for (int i = 0; i < 365; i++) {
            if (i==200){
                try {
                    thread.join();              //强制让线程插队,并执行完成
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
            System.out.println("main doing"+i);
        }
    }
}
